__________________________________________________________________________________________________
class Solution {
public:
    int maxNumberOfApples(vector<int>& arr) {
        vector<int> dp(5001,-1);
        dp[0]=0;
        for(int a:arr)
            for(int i=5000;i>=a;i--)
                if(dp[i-a]>=0)
                    dp[i]=max(dp[i],dp[i-a]+1);
        int ans=0;
        for(int i=5000;i>=0;i--)
            ans=max(ans,dp[i]);
        return ans;
    }
};
__________________________________________________________________________________________________

__________________________________________________________________________________________________
